package com.example.demo.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.example.demo.entity.Competition;
import com.example.demo.service.AdMainService;
//整合时要做修改，由主页面跳转到CompAdMain并将数据传输过去
@RestController
public class CompAdMainController {
	@Autowired
	private AdMainService adMainService;
	@RequestMapping("/AdGetCompetition")
	public ModelAndView getCompetitioninfo() {
		List<Competition> competitions=adMainService.getAllCompetitionInfoAd();
		ModelAndView mv=new ModelAndView();
		mv.addObject("competitions", competitions);
		mv.setViewName("CompAdMain.html");
		return mv;
}
}
